package web_k;

import service_k.MainUserService;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet("/mainUserPasswordServlet")
public class MainUserPasswordServlet extends HttpServlet {
    private MainUserService service = new MainUserService();

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String mainuserName = request.getParameter("mainuserName");

        System.out.println(mainuserName);

        String mainuserPassword = service.selectPassword(mainuserName);

        System.out.println(mainuserPassword);

        request.setAttribute("mainuserPassword", mainuserPassword);

        request.getRequestDispatcher("/MainUserPassword2.jsp").forward(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doGet(request, response);
    }
}
